<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Avatar extends CI_Model {

	function __construct()
	{
		parent::__construct();
	
		$ci =& get_instance();
		$this->load->helper('directory');
		$this->load->helper('file');
	}
	
	
	function get_available_avatars($avatar_path)
	{
		$avatar_path = "./" . $avatar_path;
 		$map = get_filenames($avatar_path, TRUE);
 		
		$avatar_list = array();
		foreach($map as $file) {
			$info = pathinfo($file);
			
			if($info['extension'] == "png" || $info['extension'] == "jpg") {
				$avatar_list[$info['basename']] = $info['filename'];
			}
		}
		
		return $avatar_list;
	}
}

?>
